const app = getApp()

Page({
  data: {
    //判断小程序的API，回调，参数，组件等是否在当前版本可用。
    // canIUse: wx.canIUse('button.open-type.getUserInfo')
    userInfo: {},
    hasUserInfo: false,
    canIUse: wx.canIUse('button.open-type.getUserInfo'),
    menuitems: [{
        text: '完善信息',
        url: 'cloud://wqz-001-8vh1j.7771-wqz-001-8vh1j-1301063888/图标/完善资料.png',
        icon: 'cloud://wqz-001-8vh1j.7771-wqz-001-8vh1j-1301063888/图标/完善资料.png',
        tips: ''
      },
      {
        text: '个性设置',
        url: 'cloud://wqz-001-8vh1j.7771-wqz-001-8vh1j-1301063888/图标/个性化.png',
        icon: 'cloud://wqz-001-8vh1j.7771-wqz-001-8vh1j-1301063888/图标/个性化.png',
        tips: ''
      }
    ]

  },


  onLoad: function () {
    // 查看是否授权
    wx.getSetting({
      success: function (res) {
        if (res.authSetting['scope.userInfo']) {
          wx.getUserInfo({
            success: function (res) {
              console.log(res.userInfo)
              //用户已经授权过

            }
          })
        }
      }
    })
  },
  bindGetUserInfo: function (e) {
    console.log(e.detail.userInfo)
    if (e.detail.userInfo) {
      //用户按了允许授权按钮
    } else {
      //用户按了拒绝按钮
    }
  },
  toyuxiang: function (e) {
    wx.navigateTo({
      url: '../yuxiang/yuxiang'
    })
  },

})